VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmFooter 
   BorderStyle     =   4  'Fixed ToolWindow
   Caption         =   "Add the footer"
   ClientHeight    =   9360
   ClientLeft      =   45
   ClientTop       =   315
   ClientWidth     =   10185
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   9360
   ScaleWidth      =   10185
   ShowInTaskbar   =   0   'False
   Begin VB.TextBox ENG 
      Appearance      =   0  'Flat
      Height          =   3615
      Left            =   360
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   5
      Top             =   4680
      Width           =   9495
   End
   Begin VB.TextBox CHS 
      Appearance      =   0  'Flat
      Height          =   3615
      Left            =   360
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   4
      Top             =   840
      Width           =   9495
   End
   Begin VB.CommandButton Command3 
      Cancel          =   -1  'True
      Caption         =   "Exit"
      Height          =   495
      Left            =   8400
      TabIndex        =   3
      Top             =   8640
      Width           =   1335
   End
   Begin VB.CommandButton Command2 
      Caption         =   "Apply"
      Height          =   495
      Left            =   6840
      TabIndex        =   2
      Top             =   8640
      Width           =   1335
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Submit"
      Height          =   495
      Left            =   5160
      TabIndex        =   1
      Top             =   8640
      Width           =   1335
   End
   Begin MSComctlLib.TabStrip Footer 
      Height          =   8055
      Left            =   120
      TabIndex        =   0
      Top             =   240
      Width           =   9975
      _ExtentX        =   17595
      _ExtentY        =   14208
      _Version        =   393216
      BeginProperty Tabs {1EFB6598-857C-11D1-B16A-00C0F0283628} 
         NumTabs         =   6
         BeginProperty Tab1 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "TEAM"
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab2 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "ABOUT"
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab3 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "CLAIM"
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab4 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "COOPERATION"
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab5 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "PRIVACY"
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab6 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "CONTACT"
            ImageVarType    =   2
         EndProperty
      EndProperty
   End
End
Attribute VB_Name = "frmFooter"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Private bChanged As Boolean

Private Sub CHS_KeyPress(KeyAscii As Integer)
    bChanged = True
End Sub

Private Sub Command1_Click()
    Command2_Click
    Unload Me
End Sub

Private Sub Command2_Click()
    Dim sql As String
    sql = "UPDATE `cs_footer` SET `Content`='" & AddSlashes(CHS.Text) & "',`str_eng`= '" & AddSlashes(ENG.Text) & "' WHERE Link = '" & LCase(Footer.SelectedItem.Caption) & "'"
    Call CloseRecordSet(rs)
    OperateDatabase rs, cn, sql
    bChanged = False
    MsgBox "Updated!", vbOKOnly, SOFT_TITLE
End Sub

Private Sub Command3_Click()
    Unload Me
End Sub



Private Sub ENG_KeyPress(KeyAscii As Integer)
    bChanged = True
End Sub

Private Sub Footer_BeforeClick(Cancel As Integer)
    If bChanged Then
        If vbOK = MsgBox("You will lose the changes, still do this? ", vbOKCancel, SOFT_TITLE) Then
        Else
            Cancel = 1
        End If
    End If
End Sub

Private Sub CloseRecordSet(ByRef rs As ADODB.Recordset)
On Error GoTo NoErr
        rs.Close
NoErr:
End Sub

Private Sub Footer_Click()
    load_content
End Sub

Private Sub Form_Activate()
    load_content
End Sub

Private Sub Form_Load()
    Dim sql As String
    
    Call Cn2Oversea(cn)
    On Error GoTo openDB
    sql = "SET NAMES gbk"
    Call CloseRecordSet(rs)
    OperateDatabase rs, cn, sql
openDB:
    sql = "select * from cs_footer"
    Call CloseRecordSet(rs)
    OperateDatabase rs, cn, sql

    'load_content rs
    
    bChanged = False
End Sub

Private Sub load_content()
    Dim Caption As String
    Dim sql As String
    CHS.Text = ""
    ENG.Text = ""
    Caption = Footer.SelectedItem.Caption
    
    sql = "select * from cs_footer where Link='" & LCase(Footer.SelectedItem.Caption) & "'"
    Call CloseRecordSet(rs)
    OperateDatabase rs, cn, sql
    
    CHS.Text = rs.Fields(3).Value
    ENG.Text = rs.Fields(4).Value
    
End Sub

Private Sub Form_Unload(Cancel As Integer)
    cn.Close
End Sub
